<?php
(!defined('IN_TOA') || !defined('IN_ADMIN')) && exit('Access Denied!');
get_union_add();
get_config_keytable("workclass_admin");
empty($do) && $do = 'list';
if ($do == 'list') {
	$id = getGP('id','G','int');
	$blog = $db->fetch_one_array("SELECT * FROM ".DB_TABLEPRE."workclass_form  WHERE id = '$id' and unionid='".union_id."' ");
	include_once('template/work_form_edit.php');

} elseif ($do == 'save') {
	$savetype = getGP('savetype','P');
	$id = getGP('id','P','int');
	$formname = getGP('formname','P');
	$inputname = getGP('inputname','P');
	$inputvalue = getGP('inputvalue','P');
	$type = getGP('type','P');
	$inputtype = getGP('inputtype','P');
	$inputvaluenum = getGP('inputvaluenum','P');
	$confirmation = getGP('confirmation','P');
	$template_id = getGP('template_id','P');
	$type_id = getGP('type_id','P');
	
	
	//主表信息
	$workclass_form = array(
		'formname' => $formname,
		'inputname' => $inputname,
		'inputvalue' => $inputvalue,
		'type' => $type,
		'inputtype' => $inputtype,
		'inputvaluenum' => $inputvaluenum,
		'confirmation' => $confirmation,
		'unionid' => union_id
	);
	//写入主表信息
	//insert_db('workclass_form',$workclass_form);
	update_db('workclass_form',$workclass_form, array('id' => $id));
	$id=$db->insert_id();
	$content=$formname.get_inc_log(1).$inputname.get_inc_log(1).$inputvalue.get_inc_log(1).$type.get_inc_log(1).$inputtype.get_inc_log(1).$inputvaluenum.get_inc_log(1).$confirmation;
	$title='编辑工作流表单';
	get_oa_log_dbadd($id,$content,$title,35,$_USER->id);
    goto_page('admin.php?ac=work_form&fileurl=work&template_id='.$template_id.'&type_id='.$type_id.'');

}

?>